package com.feri.rbacsys.controller;

import com.feri.rbacsys.service.intf.OssService;
import com.feri.rbacsys.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @description: 控制层实现常用的外部接口
 */
@RestController
@RequestMapping("/api/oss/")
@Api(tags = "对象存储操作")
public class OssController {
    /**
    * 注入业务逻辑层对象*/
    @Resource
    private OssService service;
    /**
    * 查询 所有数据*/
    @ApiOperation(value = "实现全部查询")
    @GetMapping("all.do")
    public R all(){
       return service.queryAll();
    }
    /**
    * 查询 所有数据*/
    @ApiOperation(value = "实现查询单个")
    @GetMapping("single.do")
    public R single(long id){
        return service.queryById(id);
    }

    @ApiOperation(value = "图片上传")
    @PostMapping("uploadimg")
    public R uploadImg(@RequestPart MultipartFile file){
        return service.uploadImg(file);
    }

}
